using System;
using System.Collections.Generic;
using System.Text;
using EnvDTE;
using System.ComponentModel;

namespace Koda.Model
{
    public class Property : IComparable<Property>, INotifyPropertyChanged
    {
        private string name;
        private string variableName;
        private CodeTypeRef codeTypeRef;
        private vsCMAccess visibility;
        private PropertyOptions options;

        public event PropertyChangedEventHandler PropertyChanged;

        public CodeTypeRef CodeTypeRef
        {
            get
            {
                return this.codeTypeRef;
            }
        }
	

        public string VariableName
        {
            get
            {
                return this.variableName;
            }
        }
        
        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                if (this.name != value)
                {
                    this.name = value;
                    this.OnPropertyChanged("Name");
                }
            }
        }

        public vsCMAccess Visibility
        {
            get
            {
                return this.visibility;
            }
            set
            {
                if (this.visibility != value)
                {
                    this.visibility = value;
                    this.OnPropertyChanged("Visibility");
                }
            }
        }

        public PropertyOptions Options
        {
            get
            {
                return this.options;
            }
            set
            {
                if (this.options != value)
                {
                    this.options = value;
                    this.OnPropertyChanged("Options");
                }
            }
        }
	

        public Property(string variableName, string name, CodeTypeRef codeTypeRef)
        {
            this.variableName = variableName;
            this.name = name;
            this.codeTypeRef = codeTypeRef;
            this.visibility = vsCMAccess.vsCMAccessPublic;
            this.options = PropertyOptions.GetSet;
        }

        public int CompareTo(Property other)
        {
            return this.Name.CompareTo(other.Name);
        }

        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

    }
}
